Xbasic

JPEG_TO_BITMAP Function

Syntax

Bitmap_Image_Data as B = JPEG_TO_BITMAP(B jpeg_data)

Arguments

Bitmap_Image_Data

A bitmap in memory in Window Bitmap (.BMP) format.

jpeg_data

A bitmap in memory in JPEG (.JPG) format.

Description

Convert a jpeg to a bitmap.

Discussion

The JPEG_TO_BITMAP() function converts a JPEG formatted bitmap in memory to a Windows Bitmap formatted image.

Example

This example converts a JPEG file to bitmap image in memory

dim jpg as B
dim bmp as B
jpg = file.to_blob("C:\User_Manual\Images\image534.jpg")
bmp = jpeg_to_bitmap(jpg)

This example illustrates the process of importing and saving a JPEG image to a table. The example assumes that you have a table called images with the following structure:

? table.external_field_name_get("images","n,t,w,d")
= Name,C,16,0 B
itmapimage,M,10,0
Jpegimage,M,10,0

Now, go to the interactive window and enter these commands:

fn = "C:\program files\a5v6\a5v6logo.jpg"
b = file.to_blob(fn)
t = table.open("images")
t.enter_begin()
t.BITMAPIMAGE = jpeg_to_bitmap(b)
t.JPEGIMAGE = b
t.enter_end(.t.)
t.close()

See Also